package fr.sunnydale.android.geek.sprite.impl;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import fr.sunnydale.android.geek.Dream;
import fr.sunnydale.android.geek.R;
import fr.sunnydale.android.geek.sprite.IFrameDef;
import fr.sunnydale.android.geek.util.Speed;

public class TerraSprite extends Sprite {

    private static IFrameDef TURN = new FrameDef(1, 1);
    private boolean hasBeenTouched = false;

    @Override
    public void init(Resources res) {
        synchronized (Dream.mTimerThread) {
            init(Bitmap.createBitmap(BitmapFactory.decodeResource(res, R.drawable.terra)), Dream.mTimerThread,
                    Speed.HALF);
        }
    }

    @Override
    public void touchAction() {
        if (!hasBeenTouched) {
            mFrameDef = TURN;
            hasBeenTouched = true;
        } else {
            mFrameDef = FrameDef.DEFAULT;
            hasBeenTouched = false;
        }
    }
}
